<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>普通员工</title>
    <link rel="stylesheet" href="../bs引用文件/css/bootstrap.min.css">
    <script type="text/javascript" src="../bs引用文件/js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../bs引用文件/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../bs引用文件/js/bootstrap-filestyle.js"></script>
    <script type="text/javascript" src="../bs引用文件/js/jquery.validate.js"></script>
    <script type="text/javascript" src="../bs引用文件/js/additional-methods.js"></script>
    <script type="text/javascript" src="../bs引用文件/js/messages_zh.js"></script>
    <link rel="stylesheet" href="../bs引用文件/bootstrap3-editable/css/bootstrap-editable.css">
    <script type="text/javascript" src="../bs引用文件/bootstrap3-editable/js/bootstrap-editable.js"></script>
    <style type="text/css">
        input.error{
            border-color: #aa1111;
            border-style: solid;
            border-width:2px;
        }
        label.error{
            color: red;
        }
    </style>
</head>
<body style="background-color: rgba(203, 205, 68, 0.2);">
<?php
session_start();
@$admin=$_SESSION["ZHe"];
if(!empty($admin)){
    $pdo=new PDO('mysql:dbname=shuju;charset=utf8','root');
    $useNamed=$pdo->prepare('select einfor.id,einfor.ygid,einfor.name,einfor.card,einfor.age,einfor.job,einfor.beizhu from einfor join yuangong on einfor.ygid=yuangong.id where yuangong.admin=:aa');
    $useNamed->execute(array('aa'=>$admin));
    $data=$useNamed->fetchAll(PDO::FETCH_NAMED);
?>
    <!--导航条-->
    <div class="container" style="border-radius: 5px; background: rgba(101, 205, 74, 0.4);height: 37px;">
        <div style="font-size: 100%;color: rgba(120, 80, 97, 0.72);" class="col-xs-8">
            [-<span style="color: #0000cc;font-size: 150%; "><?php echo @$data[0][name]; ?></span>-]你好，欢迎回到个人信息管理
        </div>
        <div style="text-align: right;font-size: 150%;color: #ac2925;" class="col-xs-4">
            <a href="../customer/Ctcdl.php">退出</a>
        </div>
    </div>
    <br/>
    <!--导航条-->
   <div class="container">
     <div class="row">
        <div class="col-xs-3">
            <div class="list-group">
                <button id="gongneng" style="width: 100%" type="button"  data-toggle="collapse" href="#collapseExample" aria-expanded="true"  class="list-group-item active">功能</button>
                <div class="collapse" id="collapseExample">
                <button style="width: 100%" type="button" class="list-group-item list-group-item-info" id="jbzlYCan">基本资料</button>
                <button style="width: 100%" type="button" class="list-group-item list-group-item-warning" id="fajianYCan">发件箱</button>
                <button style="width: 100%" type="button" class="list-group-item list-group-item-warning" id="shoujianYCan">收件箱</button>
                <button style="width: 100%" type="button" class="list-group-item list-group-item-success" id="sendYJan">发送邮件</button>
                </div>
            </div>
        </div>
        <div class="col-xs-9">
            <div id="jbzlYC" style="display: none;">
                <div class="panel panel-info">
                    <div class="panel-body">
                        <div class="row" style="width: 100%;">
                            <div class="col-xs-2" style="text-align: right">姓名：</div>
                            <div class="col-xs-7"><?php echo @$data[0][name]; ?></div>
                        </div><br/>
                        <div class="row" style="width: 100%;">
                            <div class="col-xs-2" style="text-align: right">年龄：</div>
                            <div class="col-xs-7"><?php echo @$data[0][age]; ?></div>
                        </div><br/>
                        <div class="row" style="width: 100%;">
                            <div class="col-xs-2" style="text-align: right">员工卡号：</div>
                            <div class="col-xs-7"><?php echo @$data[0][card]; ?></div>
                        </div><br/>
                        <div class="row" style="width: 100%;">
                            <div class="col-xs-2" style="text-align: right">职务：</div>
                            <div class="col-xs-7"><?php echo @$data[0][job]; ?></div>
                        </div><br/>
                        <div class="row" style="width: 100%;">
                            <div class="col-xs-2" style="text-align: right">备注：</div>
                            <textarea class="col-xs-7"><?php echo @$data[0][beizhu]; ?></textarea>
                        </div><br/>
                    </div>
                </div>
            </div>
            <div id="shoujianYC" style="display: none;">
                <table class="table table-bordered">
                    <tr>
                        <th></th><th style="text-align: center">发送人</th><th style="text-align: center">标题(点击查看)</th><th style="text-align: center">收信时间</th><th></th>
                    </tr>
                    <?php
                    $pdo=new PDO('mysql:dbname=shuju;charset=utf8','root');
                    $useSJ=$pdo->prepare('select emshoujian.id,emshoujian.title,emshoujian.neirong,emshoujian.who,emshoujian.reciveTime from emshoujian join yuangong on emshoujian.ygid=yuangong.id where admin=:admin');
                    $useSJ->execute(array('admin'=>$admin));
                    $dataSJ=$useSJ->fetchAll(PDO::FETCH_NAMED);
                    if(!empty($dataSJ)){
                        $i=1;
                        foreach($dataSJ as $key=>$value){
                            echo "<tr>";echo '<td>'.$i.'</td>' ;
                            ?>
                            <td><?php echo @$value[who];?></td>
                            <td><a tabindex="0" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo @$value[neirong];?>"><?php echo @$value[title];?></a></td>
                            <td><?php echo @$value[reciveTime];?></td>
                            <td><a id="scsj<?php echo @$value[id];?>">删除</a></td>
                            <script language=JavaScript>
                                $("#scsj<?php echo @$value[id];?>").click(function(){
                                    var r=confirm("确定要删除该条消息吗")
                                    if(r==true){
                                        $.post('delete.php',{sjid:"<?php echo @$value[id];?>"},function(){
                                            location.href="emain.php?btn=shoujianYCanbtn";
                                        });
                                    }
                                });
                            </script>
                            <?php
                            echo "</tr>";$i++;
                        }
                    }
                    ?>
                </table>
            </div>
            <div id="fajianYC" style="display: none;">
                <table class="table table-bordered">
                    <tr>
                        <th></th><th style="text-align: center">收件人</th><th style="text-align: center">标题(点击查看)</th><th style="text-align: center">发件时间</th><th></th>
                    </tr>
                    <?php
                    $pdo=new PDO('mysql:dbname=shuju;charset=utf8','root');
                    $useFJ=$pdo->prepare('select emfajian.id,emfajian.title,emfajian.neirong,emfajian.sendwho,emfajian.sendTime from emfajian join yuangong on emfajian.ygid=yuangong.id where admin=:admin');
                    $useFJ->execute(array('admin'=>$admin));
                    $dataFJ=$useFJ->fetchAll(PDO::FETCH_NAMED);
                    if(!empty($dataFJ)){
                        $j=1;
                        foreach($dataFJ as $key=>$value){
                            echo "<tr>";echo '<td>'.$j.'</td>' ;
                             ?>
                            <td><?php echo @$value[sendwho];?></td>
                            <td><a tabindex="0" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo @$value[neirong];?>"><?php echo @$value[title];?></a></td>
                            <td><?php echo @$value[sendTime];?></td>
                            <td><a id="scfj<?php echo @$value[id];?>">删除</a></td>
                            <script language=JavaScript>
                                $("#scfj<?php echo @$value[id];?>").click(function(){
                                    var r=confirm("确定要删除该条消息吗")
                                    if(r==true){
                                        $.post('delete.php',{fjid:"<?php echo @$value[id];?>"},function(){
                                            location.href="emain.php?btn=fajianYCanbtn";
                                        });
                                    }
                                });
                            </script>
                            <?php
                            echo "</tr>";$j++;
                        }
                    }
                    ?>
                </table>
            </div>
       <!--发送邮件-->
            <div id="sendYJ" style="display: none;">
                <form class="form-horizontal" id="formsend" method="post" action="delete.php">
                    <div class="form-group">
                        <label for="sendname" class="col-xs-3 control-label" style="color: blue;font-size:larger;">收件人：</label>
                        <div class="col-xs-6">
                            <input type="text" class="form-control" id="sendname" name="sendname" placeholder="请输入收件人帐号">
                        </div>
                        <div class="col-xs-3"></div>
                    </div>
                    <div class="form-group">
                        <label for="sendtitle" class="col-xs-3 control-label" style="color: blue;font-size:larger;">主题：</label>
                        <div class="col-xs-6">
                            <input type="text" class="form-control" id="sendtitle" name="sendtitle" placeholder="主题">
                        </div>
                        <div class="col-xs-3"></div>
                    </div>
                    <div class="form-group">
                        <label for="sendneirong" class="col-xs-3 control-label" style="color: blue;font-size:larger;">内容：</label>
                        <div class="col-xs-6">
                            <textarea class="form-control" id="sendneirong" name="sendneirong" style=" height: 150px; max-height: 150px;" placeholder="内容"></textarea>
                        </div>
                        <div class="col-xs-3"></div>
                    </div>
                    <input type="text" name="fasong" value="fasong" style="display: none;">
                    <button type="submit" id="" class="btn btn-success col-xs-offset-3">发送</button>
                </form>
            </div>
            <script>
                $(document).ready(function(){
                    $("#formsend").validate({
                        rules:{
                            sendname:{
                                required:true,
                                remote:{
                                    url:"yanzheng.php",
                                    type:"post",
                                    dataType:"json",
                                    data:{
                                        shoujianren:function(){ return $('#sendname').val(); }
                                    }
                                }
                            },
                            sendtitle:{
                                required:true
                            },
                            sendneirong:{
                                required:true
                            }
                        },
                        messages:{
                            sendname:{
                                remote:"用户不存在"
                            }
                        },
                        errorPlacement:function(error,element){
                            error.appendTo(element.parent().next());
                        }
                    });
                });
            </script>
            <script>
                $('#gongneng').click(function(){
                    $("#jbzlYC").hide(); $("#fajianYC").hide(); $("#shoujianYC").hide();$("#sendYJ").hide();
                });
                $('#jbzlYCan').click(function(){
                    $("#jbzlYC").show(); $("#fajianYC").hide(); $("#shoujianYC").hide();$("#sendYJ").hide();
                });
                $('#fajianYCan').click(function(){
                    $("#jbzlYC").hide(); $("#fajianYC").show(); $("#shoujianYC").hide();$("#sendYJ").hide();
                });
                $('#shoujianYCan').click(function(){
                    $("#jbzlYC").hide(); $("#fajianYC").hide(); $("#shoujianYC").show();$("#sendYJ").hide();
                });
                $('#sendYJan').click(function(){
                    $("#jbzlYC").hide(); $("#fajianYC").hide(); $("#shoujianYC").hide();$("#sendYJ").show();
                });
            </script>
        </div>
     </div>
   </div>
<?php
}else{
 ?>
    <div class="modal-dialog">
        <div class="modal-content" style="
        background: -webkit-radial-gradient(red, green, rgba(120, 121, 255, 0.64));
         background: -o-radial-gradient(red, green, rgba(120, 121, 255, 0.64));
        background: -moz-radial-gradient(red, green,rgba(120, 121, 255, 0.64));
         background: radial-gradient(red, green, rgba(120, 121, 255, 0.64));
                     ">
            <div class="modal-header">
                <h3>消息</h3>
            </div>
            <div class="modal-body">
                <p>请登录后访问...</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary">
                    <a href="../index.php" style="color:white;">确定</a>
                </button>
            </div>
        </div>
    </div>
 <?php
}
?>
<!--弹出框初始化-->
<script>
    $('[data-toggle="popover"]').popover();
</script>
<script>
    $('#gongneng').click();
    <?php
       @$btn=$_REQUEST[btn];
    ?>
    if('<?php echo @$btn;?>'=='shoujianYCanbtn'){
        $("#shoujianYCan").trigger("click");
    }
    if('<?php echo @$btn;?>'=='fajianYCanbtn'){
        $("#fajianYCan").trigger("click");
    }
</script>
</body>
</html>